void setup(void){
 
  Serial.begin(115200);

}

    int BytesAvaliable = 0;
  char Commands[2];
  char dummy[5]; 
void getCommand( char *Buffer ); 


void loop (void){ 
  BytesAvaliable = Serial.available();
  if(0 < BytesAvaliable){
    delay(50);
    BytesAvaliable = Serial.available();
      Serial.readBytes((char*) Commands, sizeof(Commands));
      if(BytesAvaliable > sizeof(Commands)){
       Serial.readBytes((char*) dummy, BytesAvaliable - sizeof(Commands));
    }
      BytesAvaliable = 0;
      getCommand(Commands);
  }
  
}


void readSerialBuffer(void){

}

void getCommand(char *Buffer)
{  
   switch (*Buffer - 48 ){
      case 0:
      /*Replace the Seria.prinln line with a call for the Attenuation control (x1)*/
        Serial.println("0x1"); 
        break;
       case 1:
         /*Replace the Seria.prinln line with a call for the Attenuation control (x10)*/
         Serial.println("0x10");
         break;
       case 2:
        /*Replace the Seria.prinln line with a call for the Attenuation control (x100)*/
         Serial.println("0x100");
         break;
       default:
       /*Do nothing in a novalid command*/
         Serial.println("No valid atenuation");
      break;
    }
    if(*(Buffer + 1) - 48)
          /*Replace line below with a change of state*/
    Serial.println("Continue");
    else
       /*Replace line below with a change of state*/
    Serial.println("Sttoped");
     
}

